<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link rel="stylesheet" href="${ctx}/css/base.css">
<link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all">
<link rel="stylesheet" href="${ctx}/layui/css/asset-in-view.css" media="all">
<script src="${ctx}/js/jsutils.js"></script>
<script type="text/javascript"></script>
<!-- <style type="text/css">
	.layui-table-box{
		height:550px;
	}
</style> -->
</head>
<body>
	<div class="body_top_marger10 body_center">
			<div class="layui-main layui-form-pane">
			
				<ul class="layui-tab-title" style="margin-bottom: 10px">
					<li class="layui-this">基本信息</li>
				</ul>
				
				<form class="layui-form" action="">
				
					<div class="layui-form-item">
						<label class="layui-form-label">单号</label>
						<div class="layui-input-inline" style="width:200px">
							<input type="text" id="id" name="id" value="${assetScrap.id }" class="layui-input">
						</div>
						
						<div class="layui-input-inline" style="width:110px">&nbsp;</div>
						
						<label class="layui-form-label">申请人</label>
						<div class="layui-input-inline" style="width:220px">
							<input type="text" id="createUserName" name="createUserName" value="${assetScrap.createUserName }" class="layui-input">
						</div>
					</div>
					
					<div class="layui-form-item">
							<label class="layui-form-label">申请时间</label>
							<div class="layui-input-inline" style="width:200px">
								<input type="text" id="createTime" name="createTime" value="${assetScrap.createTimeStr}" class="layui-input">
							</div>
							
							<div class="layui-input-inline" style="width:110px">&nbsp;</div>
							
							<%--<label class="layui-form-label" style="height:80px;display:flex;justify-content:center;align-items:center">备注</label>--%>
							<%--<div class="layui-input-inline" style="width:220px">--%>
								<%--<textarea name="remark" style="width:100%;height: 80px;box-sizing:border-box">${assetScrap.remark }</textarea>--%>
							<%--</div>--%>
					</div>

					<div class="layui-form-item layui-form-text">
						<label class="layui-form-label">备注</label>
						<div class="layui-input-block">
							<textarea id="remark" name="remark" disabled class="layui-textarea">${assetScrap.remark }</textarea>
						</div>
					</div>


					<div class="layui-form-item">
						<label class="layui-form-label" style="height:100px;display:flex;justify-content:center;align-items:center">照片</label>
							<div>
						<c:forEach items="${assetScrap.imgList }" var="img">
								<img style="width:150px;height:100px" src="${img }"/>
						</c:forEach>
							</div>
					</div>
						<c:forEach items="${assetScrap.typeList }" var="obj">
							<div class="layui-form-item" style="white-space:nowrap">
									<div style="display: inline-block">
										<label class="layui-form-label" >类型</label>
										<div class="layui-input-inline" style="width:110px;text-align: center">
											<input type="text"  disabled id="typeName" name="typeName" value="${obj.name }" class="layui-input">
										</div>
									</div>
									<div style="display:inline-block">
										<label class="layui-form-label" >数量</label>
										<div class="layui-input-inline" style="width:180px;text-align: center">
											<input type="text"  disabled name="outCount" id="outCount" value="${obj.num }" class="layui-input"/>
										</div>
									</div>
									<div style="display: inline-block">
										<label class="layui-form-label" >确认数量</label>
										<div class="layui-input-inline" style="width:180px">
											<input type="text"  disabled name="truthCount" id="truthCount" value="${obj.confirmNum}" class="layui-input"/>
										</div>
									</div>
							</div>
						</c:forEach>
						<div class="layui-form-item" style="white-space:nowrap">
							<div style="display:inline-block">
								<label class="layui-form-label" >审批人</label>
								<div class="layui-input-inline" style="width:110px">
									<input type="text" id="approveName" name="approveName" value="${assetScrap.approveName }" class="layui-input">
								</div>
							</div>
							<div style="display:inline-block">
								<label class="layui-form-label" >审批时间</label>
								<div class="layui-input-inline" style="width:180px">
									<input type="text" id="approveDate" name="approveDate" value="${assetScrap.approveDateStr }" class="layui-input" >
								</div>
							</div>
							<div style="display:inline-block">
								<label class="layui-form-label" >完成时间</label>
								<div class="layui-input-inline" style="width:180px">
									<input type="text" id="completeTime" name="completeTime" value="${assetScrap.comTimeStr }" class="layui-input" >
								</div>
							</div>
						</div>
					
						<c:set var="parentRowIndex" value="${parent_row}"/>
						<div id="itemTable">
				   
				    <div align="center">
						<input class="layui-btn layui-btn-primary layui-btn-danger" type="button" onclick="refuse(${assetScrap.id },${assetScrap.status });" value="驳回"  />
						<input class="layui-btn layui-btn-primary layui-btn-normal" type="button" onclick="scrapPass(${assetScrap.id })" value="通过"  />
					</div>
						</div>
						
				</form>
			</div>
		</div>
		
</body>
	<script src="${ctx}/js/jquery.min.js"></script>
	<script src="${ctx}/layui/layui/layui.js"></script>
<script type="text/javascript">
	var rootPath = '${ctx}';
	var parentRowIndex = '${parentRowIndex}';
</script>
<script type="text/html" id="titleTpl">
	{{#  if(d.scrapStatus == 1 || d.scrapStatus == '1'){ }}
		<label>报废</label>
	{{#  } else { }}
		<label>未处理</label>
	{{#  } }}
</script>
<script src="${ctx}/js/assetscrap/assetscrap_view.js"></script>
<script type="text/javascript">
	function refuse(obj, status){
		console.info(status);
		layer.open({
			type : 2,
			title : '驳回理由',
			area : [ '400px', '280px' ],
			content : './showRefuseWindow.shtml?id=' + obj,
			maxmin : true,
			fixed: false
		}); 
	}
	
	
	/*报废单审核通过*/
	function scrapPass(obj){
		if( window.confirm("确定要通过吗？") ) {
		   $.ajax({
               type:"post",
               url:"${pageContext.request.contextPath }/assetscrap/approveAssetsScrap.shtml?id=" + obj,
               dataType : "json",
  			   contentType: "application/x-www-form-urlencoded; charset=UTF-8",
               success:function(d){
                   if(d.code=="success"){
                       layer.msg(d.msg, {time: 2000});
                   }else{
                       layer.msg(d.msg);
                   }

                   setTimeout("parent.layer.close(parent.layer.getFrameIndex(window.name))", 2000);
                   parent.parent.refreshAssetScrapList();
               },
  			   error:function(d){
  				 var result = d;
  				 var code = result.responseText;
                 setTimeout("parent.layer.close(parent.layer.getFrameIndex(window.name))", 2000);
  			   }
           });
		   
		}
	}
	
</script>
<script src="${ctx}/js/assetscrap/assetscrapindex.js"></script>
</html>